<!DOCTYPE html>
<html>

<head>
	<title>补货</title>
	<meta charset="utf-8">
	<link rel="shortcut icon" href="favicon.ico">
	<link href="__STATIC__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link href="__STATIC__/css/font-awesome.css" rel="stylesheet">
	<link href="__STATIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
	<link href="__STATIC__/css/animate.css" rel="stylesheet">
	<link href="__STATIC__/css/style.css?v=4.1.0" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="__STATIC__/xinli/css/history.css">
	<style type="text/css">
		.memu>span>a {
			color: yellow;
		}

		.middle-line1-content {
			width: 99%;
			background-color: rgba(182, 171, 171, 0.56);
			font-size: 12px;
			border: 1px solid rgba(128, 128, 128, 0.72);
			border-radius: 5px;
			margin: 0 auto;
		}

		.middle-line1-content>div {
			margin-top: 3px;
			padding: 6px 0 6px 13px;
		}

		.table-or {
			background-color: rgba(219, 81, 4, 0.78);
			color: white;
			font-size: 12px;
			text-align: center;
			width: 20%;
		}

		.middle-form-content {
			width: 60%;
		}

		select {
			padding: 1px;
			padding-bottom: 4px;
		}

		.buttons {
			display: inline-block;
		}

		.selectss {
			display: inline-block;
			padding: 0 10px 0 60px;
		}

		input {
			width: 80px;
			padding-left: 3px;
			border: 1px solid rgb(33, 150, 243);
			border-radius: 3px;
		}

		.font-red {
			color: red;
			margin-left: 10%;
		}

		.boton {
			text-align: center;
			width: 100%;
		}

		.boton>button {
			padding: 2px 15px;
		}

		.form-size {
			margin: 7px;
			border: 1px solid rgba(128, 128, 128, 0.29);
			padding: 6px;
		}

		.inp1 {
			width: 120px;
			margin-right: 5px;
		}

		.middle-line1-leftdate {
			width: 15%;
			float: left;
		}

		.replen {
			width: 99%;
			margin: 10px auto;
			border: 1px solid silver;
			border-radius: 5px;
		}

		.replen>table>tbody>tr>td {
			background: rgb(240, 240, 240);
			padding: 3px 0;
			border: 1px solid rgb(214, 214, 214);
			text-align: center;
			color: black;
		}

		.replen>table>thead>tr>td {
			background: rgb(240, 240, 240);
			padding: 3px 0;
			border: 1px solid rgb(214, 214, 214);
			text-align: center;
			color: black;
		}

		.replen>table>thead>tr>th {
			background: rgb(224, 139, 46);
			padding: 3px 0;
			border: 1px solid rgb(214, 214, 214);
			text-align: center;
			color: white;
		}

		.buttonone {
			border: 1px solid gray;
			padding: 2px 5px;
			border-radius: 3px;
			cursor: pointer;
		}

		.numred1 {
			border: 1px solid red;
			padding: 2px 8px;
			border-radius: 50%;
			background: red;
			color: white;
			font-weight: bold;
			font-size: 20px;
		}

		.numblue1 {
			border: 1px solid blue;
			padding: 2px 8px;
			border-radius: 50%;
			background: blue;
			color: white;
			font-weight: bold;
			font-size: 20px;
		}

		.numgreen1 {
			border: 1px solid green;
			padding: 2px 8px;
			border-radius: 50%;
			background: green;
			color: white;
			font-weight: bold;
			font-size: 20px;
		}

		.numred {
			border: 1px solid red;
			padding: 2px 2px;
			border-radius: 50%;
			background: red;
			color: white;
			font-weight: bold;
			font-size: 20px;
		}

		.numblue {
			border: 1px solid blue;
			padding: 2px 2px;
			border-radius: 50%;
			background: blue;
			color: white;
			font-weight: bold;
			font-size: 20px;
		}

		.numgreen {
			border: 1px solid green;
			padding: 2px 2px;
			border-radius: 50%;
			background: green;
			color: white;
			font-weight: bold;
			font-size: 20px;
		}
	</style>
</head>

<body>
	<div>
		<div class="heads">
			<div class="poly">保利</div>
			<div style="clear: both;"></div>

			<div style="position: relative;width: 80%;float: right;">
				<div class="arrow-left"></div>
				<div class="memus" style="height: 30px;">
					<div class="bevel"></div>
					<div style="clear: both;"></div>
					{switch name=":session('usertype')"} {case value="1"}
					<span>
						<a href="{:url('admin/home/plate')}">开封盘</a>
					</span>
					<span>
						<a href="{:url('admin/home/oddstema')}">赔率设置</a>
					</span>
					<span>
						<a href="{:url('admin/Single/injection')}">即时注单</a>
					</span>
					<span>
						<a href="{:url('admin/home/replenishment')}">补货</a>
					</span>
					<span>
						<a href="{:url('admin/home/director')}">总监</a>
					</span>
					<span>
						<a href="{:url('admin/home/bigshareholders')}">大股东</a>
					</span>
					<span>
						<a href="{:url('admin/home/shareholders')}">股东</a>
					</span>
					<span>
						<a href="{:url('admin/home/bigangent')}">总代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/angent')}">代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/members')}">会员</a>
					</span>
					<!-- <span>
						<a href="{:url('admin/home/Traders')}">操盘员</a>
					</span> -->
					<span>
						<a href="{:url('admin/home/system')}">系统配置</a>
					</span>
					<span>
						<a href="{:url('admin/home/Notice')}">公告</a>
					</span>
					<span>
						<a href="{:url('admin/home/notecheck')}">注单查询</a>
					</span>
					<span>
						<a href="{:url('admin/home/red')}">报表</a>
					</span>
					<span>
						<a href="{:url('admin/home/fot')}">客服</a>
					</span>
					<span>
						<a href="{:url('admin/home/Onlinepersonnel')}">在线人员</a>
					</span>
					<span>
						<a href="{:url('admin/login/logout')}">登出</a>
					</span>
					{/case} {case value="2"} {switch name=":session('roots')"} {case value="0"}
					<span>
						<a href="{:url('admin/Single/injection')}">即时注单</a>
					</span>
					<span>
						<a href="{:url('admin/home/replenishment')}">补货</a>
					</span>
					<span>
						<a href="{:url('admin/home/director')}">总监</a>
					</span>
					<span>
						<a href="{:url('admin/home/bigshareholders')}">大股东</a>
					</span>
					<span>
						<a href="{:url('admin/home/shareholders')}">股东</a>
					</span>
					<span>
						<a href="{:url('admin/home/bigangent')}">总代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/angent')}">代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/members')}">会员</a>
					</span>
					<span>
						<a href="{:url('admin/home/notecheck')}">注单查询</a>
					</span>
					<span>
						<a href="{:url('admin/home/red')}">报表</a>
					</span>
					<span>
						<a href="{:url('admin/home/Onlinepersonnel')}">在线人员</a>
					</span>
					<span>
						<a href="{:url('admin/login/logout')}">登出</a>
					</span>
					{/case} {case value="1"}
					<span>
						<a href="{:url('admin/home/plate')}">开封盘</a>
					</span>
					<span>
						<a href="{:url('admin/home/oddstema')}">赔率设置</a>
					</span>
					<span>
						<a href="{:url('admin/Single/injection')}">即时注单</a>
					</span>
					<span>
						<a href="{:url('admin/home/replenishment')}">补货</a>
					</span>
					<span>
						<a href="{:url('admin/home/director')}">总监</a>
					</span>
					<span>
						<a href="{:url('admin/home/bigshareholders')}">大股东</a>
					</span>
					<span>
						<a href="{:url('admin/home/shareholders')}">股东</a>
					</span>
					<span>
						<a href="{:url('admin/home/bigangent')}">总代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/angent')}">代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/members')}">会员</a>
					</span>
					<!-- <span>
						<a href="{:url('admin/home/Traders')}">操盘员</a>
					</span> -->
					<span>
						<a href="{:url('admin/home/system')}">系统配置</a>
					</span>
					<span>
						<a href="{:url('admin/home/Notice')}">公告</a>
					</span>
					<span>
						<a href="{:url('admin/home/notecheck')}">注单查询</a>
					</span>
					<span>
						<a href="{:url('admin/home/red')}">报表</a>
					</span>
					<span>
						<a href="{:url('admin/home/fot')}">客服</a>
					</span>
					<span>
						<a href="{:url('admin/home/Onlinepersonnel')}">在线人员</a>
					</span>
					<span>
						<a href="{:url('admin/login/logout')}">登出</a>
					</span>
					{/case} {default /}
					<span>
						<a href="{:url('admin/login/logout')}">登出</a>
					</span>
					{/switch} {/case} {case value="3"}
					<span>
						<a href="{:url('admin/Single/injection')}">即时注单</a>
					</span>
					<span>
						<a href="{:url('admin/home/replenishment')}">补货</a>
					</span>
					<span>
						<a href="{:url('admin/home/bigshareholders')}">大股东</a>
					</span>
					<span>
						<a href="{:url('admin/home/shareholders')}">股东</a>
					</span>
					<span>
						<a href="{:url('admin/home/bigangent')}">总代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/angent')}">代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/members')}">会员</a>
					</span>
					<span>
						<a href="{:url('admin/home/notecheck')}">注单查询</a>
					</span>
					<span>
						<a href="{:url('admin/home/red')}">报表</a>
					</span>
					<span>
						<a href="{:url('admin/home/Onlinepersonnel')}">在线人员</a>
					</span>
					<span>
						<a href="{:url('admin/login/logout')}">登出</a>
					</span>
					{/case} {case value="4"}
					<span>
						<a href="{:url('admin/Single/injection')}">即时注单</a>
					</span>
					<span>
						<a href="{:url('admin/home/replenishment')}">补货</a>
					</span>
					<span>
						<a href="{:url('admin/home/shareholders')}">股东</a>
					</span>
					<span>
						<a href="{:url('admin/home/bigangent')}">总代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/angent')}">代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/members')}">会员</a>
					</span>
					<span>
						<a href="{:url('admin/home/notecheck')}">注单查询</a>
					</span>
					<span>
						<a href="{:url('admin/home/red')}">报表</a>
					</span>
					<span>
						<a href="{:url('admin/home/Onlinepersonnel')}">在线人员</a>
					</span>
					<span>
						<a href="{:url('admin/login/logout')}">登出</a>
					</span>
					{/case} {case value="5"}
					<span>
						<a href="{:url('admin/Single/injection')}">即时注单</a>
					</span>
					<span>
						<a href="{:url('admin/home/replenishment')}">补货</a>
					</span>
					<span>
						<a href="{:url('admin/home/bigangent')}">总代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/angent')}">代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/members')}">会员</a>
					</span>
					<span>
						<a href="{:url('admin/home/notecheck')}">注单查询</a>
					</span>
					<span>
						<a href="{:url('admin/home/red')}">报表</a>
					</span>
					<span>
						<a href="{:url('admin/home/Onlinepersonnel')}">在线人员</a>
					</span>
					<span>
						<a href="{:url('admin/login/logout')}">登出</a>
					</span>
					{/case} {case value="6"}
					<span>
						<a href="{:url('admin/Single/injection')}">即时注单</a>
					</span>
					<span>
						<a href="{:url('admin/home/replenishment')}">补货</a>
					</span>
					<span>
						<a href="{:url('admin/home/angent')}">代理</a>
					</span>
					<span>
						<a href="{:url('admin/home/members')}">会员</a>
					</span>
					<span>
						<a href="{:url('admin/home/notecheck')}">注单查询</a>
					</span>
					<span>
						<a href="{:url('admin/home/red')}">报表</a>
					</span>
					<span>
						<a href="{:url('admin/home/Onlinepersonnel')}">在线人员</a>
					</span>
					<span>
						<a href="{:url('admin/login/logout')}">登出</a>
					</span>
					{/case} {default /}
					<span>
						<a href="{:url('admin/login/logout')}">登出</a>
					</span>
					{/switch}
				</div>
				<div style="clear: both;"></div>


				<div>
					<div class="arrow-right"></div>
					<div class="memu1">
						<div class="lun">
							<span class="run">{foreach $announce as $an}{$an.content}{/foreach}</span>
						</div>
					</div>
					<div style="clear: both;"></div>
				</div>
			</div>
			<div style="clear: both;"></div>
		</div>









		<div class="middle">
			<div class="middle-line1-content">
				<div class="middle-line1-leftdate">补货:{$datatime}期</div>
				<div class="middle-line1-leftselect">
					<span>查看</span>
						<select name="type" onclick="gethand();">
							<option value="1">实货</option>
							<option value="2">成数</option>
							<option value="3">收补</option>
							<option value="4">补货</option>
							<option value="5">实+外</option>
						</select>
						<span>盘类</span>
						<select name="andicap" onclick="gethand();">
							<option value="1">A</option>
							<option value="2">B</option>
							<option value="3">C</option>
							<option value="4">D</option>
						</select>
						<span>更新</span>
						<select name="upd" onclick="gethand();">
							<option value="0">停止</option>
							<option value="1">10秒</option>
							<option value="2">20秒</option>
							<option value="3">60秒</option>
						</select>
					<span style="margin-left: 3%;">香港时间:
						<span id="time1" style="color: #281f1f;"></span>
					</span>&emsp;
					<span id="kaipan">距离
						<b style="color: red">开盘</b>时间还有
						<span class="myDiv"><span id="div1"></span></span>					
					</span>
				</div>
				<div style="clear: both;"></div>
			</div>
			<div class="replen">
				<table style="width: 100%;">
					<thead>
						<tr>
							<td>设置</td>
							<td colspan="6">
								<input type="radio" name="aaa" style="width: 13px;height: 13px;">
								<span>A:平均吃码</span>
								<input type="text" name="" placeholder="0" onkeyup="this.value=this.value.replace(/\D/g,'')">
								<input type="radio" name="aaa" style="width: 13px;height: 13px;">
								<span>B:最大负数</span>
								<input type="text" name="" placeholder="0" onkeyup="this.value=this.value.replace(/\D/g,'')">
								<span class="buttonone">设置</span>
								<span class="buttonone" style="border: 2px solid rgb(33, 150, 243);" onclick="sent()">送出补货</span>
								<span class="buttonone">刷新</span>
								<span>查看类型：</span>
								<select name = "status" onclick="gethand();">
									<option value="1">特码</option>
									<option value="2">正1特</option>
									<option value="3">正2特</option>
									<option value="4">正3特</option>
									<option value="5">正4特</option>
									<option value="6">正5特</option>
									<option value="7">正6特</option>
								</select>
							</td>
						</tr>
					</thead>
				
	
					<thead  >
						<tr>
							<th data-type="num">序号</th>
							<th data-type="num">号码</th>
							<th data-type="num">赔率</th>
							<th data-type="num">注单</th>
							<th data-type="num">预计盈亏</th>
							<th data-type="num">已补货</th>
							<th data-type="num">补货</th>
						</tr>
					</thead>
					<tbody >
						{foreach name="arr" item="a" key="k"}
						<tr>
							<td>{$k}</td>
							<td>
								<span ><input type="hidden" name="bets">{$a.num}</span>
							</td>
							<td>{$a.rate}</td>
							<td>{$a.sandb}</td>
							<td>{$a.yk}</td>
							<td id="yibuhuo">{$a.bh}</td>
							<td>
								<input  type="text" name="price" data-price="{$a.sandb}" data-id="{$a.num}" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')">
							</td>
						</tr> 
						{/foreach}
					</tbody>
				</table>
			</div>
			<input id="reset" type="reset" name="reset" style="display: none;" />

<iframe id="id_iframe" name="id_iframe" style="display:none;"></iframe> 

		</div>
	</div>
	<!-- 全局js -->
	<script src="__STATIC__/js/jquery.min.js?v=2.1.4"></script>
	<script src="__STATIC__/js/bootstrap.min.js?v=3.3.6"></script>
	<!-- 自定义JS -->
	<!-- <script src="__STATIC__/js/admin/controtiren.js"></script> -->
	<script type="text/javascript">
		// var tbody = document.querySelector('#tableSort').tBodies[0];
		// var th = document.querySelector('#tableSort').tHead.rows[0].cells;
		// var td = tbody.rows;
		// for (var i = 0;i < th.length;i++){
		//   th[i].flag = 1;
		//   th[i].onclick = function(){
		//     sort(this.getAttribute('data-type'),this.flag,this.cellIndex);
		//     this.flag = -this.flag;
		//   };
		// };
		// function sort(str,flag,n){
		//   var arr = []; //存放DOM
		//   for (var i = 0;i < td.length;i++){
		//     arr.push(td[i]);
		//   };
		//   //排序
		//   arr.sort(function(a,b){
		//     return method(str,a.cells[n].innerHTML,b.cells[n].innerHTML) * flag;
		//   });
		//   //添加
		//   for (var i = 0;i < arr.length;i++){
		//     tbody.appendChild(arr[i]);
		//   };
		// };
		// //排序方法
		// function method(str,a,b){
		//   switch (str){
		//   case 'num': //数字排序
		//     return a-b;
		//     break;
		//   case 'string': //字符串排序
		//     return a.localeCompare(b);
		//     break;
		//   default:  //日期排序，IE8下'2012-12-12'这种格式无法设置时间，替换成'/'
		//     return new Date(a.split('-').join('/')).getTime()-new Date(b.split('-').join('/')).getTime();
		//   };
		// };	
		window.onload=function() {
		}

		$(function(){
			$("select[name=type]").val({$type});
			$("select[name=status]").val({$status});
			$("select[name=andicap]").val({$andicap});
			var upd = $("select[name=upd]").val({$upd});
			if(upd==0){
			}else if(upd==1){
				setTimeout('myrefresh()',10000);
			}else if(upd==2){
				setTimeout('myrefresh()',20000);
			}else if(upd==3){
				setTimeout('myrefresh()',60000);
			}
		})
		function myrefresh(){ 
			window.location.reload(); 
		} 
		 
		// function submitForm() {		
		// 		var form = document.getElementById("my_form"); //获取form表单对象
		// 		form.submit(); //form表单提交
		// 		alert("补货成功");
		// 		document.getElementById("yibuhuo").innerHTML=document.getElementById("shuru").value;
		// 		document.getElementById("shuru").value=0;
		// }
		var storage = window.localStorage;
		var items = [];
		var status =1;
		var andicap =1;
		function gethand(){
			var type = $("select[name=type]").val();
			var status = $("select[name=status]").val();
			var andicap = $("select[name=andicap]").val();
			var upd = $("select[name=upd]").val();
			window.location.href="{:url('admin/home/replenishment')}?type="+type+"&status="+status+"&andicap="+andicap+"&upd="+upd;
		}
		function sent(){
			$("input[name=price]").each(function(index,item){
				var p = $(this).attr("data-price");
				var bets = $(this).attr("data-id");
				 var price = item.value;
				 if(price>p){
				 	alert('补货量不足');
				 	return;
				 }
				 if(status==1){
				 	var bet = 1;
				 	var colums = 1;
				 }if(status==2){
				 	var bet = 3;
				 	var colums = 1;
				 }
				 if(status==3){
				 	var bet = 3;
				 	var colums = 2;
				 }
				 if(status==4){
				 	var bet = 3;
				 	var colums = 3;
				 }
				 if(status==5){
				 	var bet = 3;
				 	var colums = 4;
				 }
				 if(status==6){
				 	var bet = 3;
				 	var colums = 5;
				 }
				 if(status==7){
				 	var bet = 3;
				 	var colums = 6;
				 }
				 if (item.value != 0) {
					var data = {
						'andicap': andicap,
						'bet': bet,
						'colums': colums,
						'bets': bets,
						'price': price
					}
					items.push(data);
					items = JSON.stringify(items);
					storage.setItem("items", items);
					items = JSON.parse(storage.getItem("items"));
				}
			})
			var dats = storage.getItem("items");
			storageuploadp(dats);
		}
		//不知道
			var jine = ''
		    var dataTime = {$opentime};
		    //时间戳转dddd-mm-dd HH24:hh:MM:ss
		    if(dataTime == 1){
				function count() {
						document.getElementById("kaipan").innerHTML = "开盘中";
			    }		    
			}else{
		    var d = new Date(dataTime * 1000);
		    var date = (d.getFullYear()) + "-" + (d.getMonth() + 1) + "-" + (d.getDate()) + "-" + (d.getHours()) + ":" + (d.getMinutes()) + ":" + (d.getSeconds());
		    var startTime = date;
		    console.info(startTime)
			    function count() {
			        var currTime = new Date(); //当前时间  
			        //将xxxx-xx-xx的时间格式，转换为 xxxx/xx/xx的格式  
			        startTime = startTime.replace(/\-/g, "/");
			        var sTime = new Date(startTime);
			        var totalTime = sTime.getTime() - currTime.getTime();
			        var days = parseInt(totalTime / parseInt(1000 * 60 * 60 * 24));
			        totalTime = totalTime % parseInt(1000 * 60 * 60 * 24);
			        var hours = parseInt(totalTime / parseInt(1000 * 60 * 60));
			        totalTime = totalTime % parseInt(1000 * 60 * 60);
			        var minutes = parseInt(totalTime / parseInt(1000 * 60));
			        totalTime = totalTime % parseInt(1000 * 60);
			        var seconds = parseInt(totalTime / parseInt(1000));
			        var time = "";
			        if(days<1&& hours >= 1){
			            time = hours + "时" + minutes + "分" + seconds + "秒";
			        }else if(hours<1&&minutes >= 1){
			            time = minutes + "分" + seconds + "秒";
			        }else{
			             time = seconds + "秒";
			        }
			        document.getElementById("div1").innerHTML = "" + time ;
			        setTimeout("count()", 1000);
			    }
		    }
		    window.onload = count;

		function storageuploadp(dats) {
			if (dats == "") return 0;
			$.post('{:url("admin/Interfaces/sentbuhuo")}', {data:dats}, function(res) {
				console.log(res)
				if (res == 1) {
					localStorage.clear();
					alert('送出补货成功');
					document.location.reload();
				} else {
					alert('送出补货失败');
					document.location.reload();
				}
			})
		}
		function mytime() {
			var a = new Date();
			var b = a.toLocaleTimeString();
			var c = a.toLocaleDateString();
			document.getElementById("time1").innerHTML = c + "&nbsp" + b;
		}
		setInterval(function () {
			mytime()
		}, 1000);

		//公告轮播
		$(function () {
			var price = 0
			//轮播
			var left = 0;

			function move() {
				left--
				if (left < -$(".run").width()) {
					left = 0
				}
				$(".run").css("left", left + "px")
			}
			setInterval(move, 60)
		})
	</script>

</body>

</html>